package com.ershi.spring.component.bfpp;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.stereotype.Component;

/**
 * @author 二十
 * @since 2021/10/15 8:59 上午
 */
@Component
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
	@Override
	public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
		System.out.println("=======BeanFactoryPostProcessor=========");
		BeanDefinition person = beanFactory.getBeanDefinition("computer");
		person.setScope(BeanDefinition.SCOPE_PROTOTYPE);
		System.out.println("=======BeanFactoryPostProcessor=========");
	}
}
